home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
bbsutil
/
bsrc_250.zip
/
MAILROOT.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-09-15
|
22KB
|
687 lines
/*--------------------------------------------------------------------------*/
/* */
/* */
/* ------------ Bit-Bucket Software, Co. */
/* \ 10001101 / Writers and Distributors of */
/* \ 011110 / Freely Available<tm> Software. */
/* \ 1011 / */
/* ------ */
/* */
/* (C) Copyright 1987-91, Bit Bucket Software Co., a Delaware Corporation. */
/* */
/* */
/* This module was written by Bob Hartman */
/* */
/* */
/* BinkleyTerm Mail Control Routines */
/* */
/* */
/* For complete details of the licensing restrictions, please refer */
/* to the License agreement, which is published in its entirety in */
/* the MAKEFILE and BT.C, and also contained in the file LICENSE.250. */
/* */
/* USE OF THIS FILE IS SUBJECT TO THE RESTRICTIONS CONTAINED IN THE */
/* BINKLEYTERM LICENSING AGREEMENT. IF YOU DO NOT FIND THE TEXT OF */
/* THIS AGREEMENT IN ANY OF THE AFOREMENTIONED FILES, OR IF YOU DO */
/* NOT HAVE THESE FILES, YOU SHOULD IMMEDIATELY CONTACT BIT BUCKET */
/* SOFTWARE CO. AT ONE OF THE ADDRESSES LISTED BELOW. IN NO EVENT */
/* SHOULD YOU PROCEED TO USE THIS FILE WITHOUT HAVING ACCEPTED THE */
/* TERMS OF THE BINKLEYTERM LICENSING AGREEMENT, OR SUCH OTHER */
/* AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO. */
/* */
/* */
/* You can contact Bit Bucket Software Co. at any one of the following */
/* addresses: */
/* */
/* Bit Bucket Software Co. FidoNet 1:104/501, 1:343/491 */
/* P.O. Box 460398 AlterNet 7:491/0 */
/* Aurora, CO 80046 BBS-Net 86:2030/1 */
/* Internet f491.n343.z1.fidonet.org */
/* */
/* Please feel free to contact us at any time to share your comments about */
/* our software and/or licensing policies. */
/* */
/*--------------------------------------------------------------------------*/
/* Include this file before any other includes or defines! */
#include "includes.h"
char *estring (int, int);
int do_mail (ADDRP baddr, int type) /* 1 = manual, 0 = normal, -1 = CM */
{
int i;
long callstart, callend;
long call_cost, call_cost_ths;
long eh, em, es;
b_init ();
caller = 1;
got_packet = 0;
got_arcmail = 0;
got_mail = 0;
sent_mail = 0;
no_WaZOO_Session = no_WaZOO;
callstart = 0L;
#ifdef MILQ
UsePaths = FALSE;
#endif
(void) sprintf (junk, "%s", Full_Addr_Str (baddr));
called_addr = remote_addr = *baddr; /* structure assignment */
SendMessage( node_hWnd, WM_COMMAND, GD_CRNT, (long)baddr );
if (!net_params)
{
status_line (MSG_TXT(M_INSUFFICIENT_DATA));
set_xy ("");
return (0);
}
if (!nodeproc (junk))
return (0);
if (type > 0)
{
if (flag_file (TEST_AND_SET, &called_addr, 1))
{
if (CARRIER)
mdm_hangup ();
return (0);
}
if (CARRIER) /* called manually maybe? */
goto process_the_damned_mail; /* yup, just do some mail */
do_dial_strings ();
try_2_connect ((char *) (newnodedes.PhoneNumber)); /* try to connect */
}
else
{
/* If this is supposed to be only local, then get out if it isn't */
if (type == 0)
{
if (e_ptrs[cur_event].behavior & MAT_LOCAL)
{
if (e_ptrs[cur_event].node_cost < 0)
{
if ((int) newnodedes.RealCost < -e_ptrs[cur_event].node_cost)
{
return (0);
}
}
else
{
if ((int) newnodedes.RealCost > e_ptrs[cur_event].node_cost)
{
return (0);
}
}
}
/* If it is supposed to be 24 hour mail only, get out if it isn't */
if ((newnodelist || version7) &&
(!(e_ptrs[cur_event].behavior & MAT_NOMAIL24)) &&
(!(newnodedes.NodeFlags & B_CM)))
return (0);
/* If we aren't supposed to send to CM's now, get out */
if ((newnodelist || version7) &&
(e_ptrs[cur_event].behavior & MAT_NOCM) &&
(newnodedes.NodeFlags & B_CM))
return (0);
}
/* Try to connect */
if (flag_file (TEST_AND_SET, &called_addr, 1))
{
if (CARRIER)
mdm_hangup ();
return (0);
}
do_dial_strings ();
if (un_attended && fullscreen)
{
sb_move (hold_hWnd, 2, 1);
sb_wa (hold_hWnd, colors.calling, 31);
}
callstart = time (NULL);
if (!blank_on_key)
screen_blank = 0;
if ((i = try_1_connect ((char *) (newnodedes.PhoneNumber))) < 0)
{
if (un_attended && fullscreen)
{
sb_move (hold_hWnd, 2, 1);
sb_wa (hold_hWnd, colors.hold, 31);
}
(void) flag_file (CLEAR_FLAG, &called_addr, 1);
return (i);
}
}
process_the_damned_mail:
if (CARRIER) /* if we did, */
{
if (type > 0)
callstart = time (NULL);
b_session (1); /* do a mail session */
callend = time (NULL);
hist.last_Elapsed = callend - callstart;
eh = (callend - callstart) / 3600L;
em = ((callend - callstart) / 60L) - (eh * 60L);
es = (callend - callstart) - (eh * 3600L) - (em * 60L);
hist.callcost += (call_cost = cost_of_call (callstart, callend));
call_cost_ths = call_cost % 100L; /* Separate dollars & */
call_cost = call_cost / 100L; /* cents for formats */
#ifdef MILQ
sprintf( last_Elapsed_Str,
"%02d:%02d:%02d",
eh, em, es );
sb_puts( node_Elapsed, last_Elapsed_Str );
#endif
status_line (MSG_TXT(M_NODE_COST), Full_Addr_Str (baddr),
eh, em, es, call_cost, call_cost_ths);
mdm_hangup ();
#ifdef MILQ
UsePaths = FALSE;
#en